package com.bangcommunity.bbframe.sdm.web.taglib.page;

import com.bangcommunity.bbframe.common.base.CommonList;

/**
 * User: joeytang Date: 2015-12-29 13:54
 */
public abstract class AbstractPagesModel implements PagesModel {

    @Override
    public abstract String genPageHtml(CommonList cl, int pageNum, String op);

    public String getPageFun(int pageNo, String url, String target, String op, String searchStr) {
        StringBuffer sbuf = new StringBuffer();
        if (null == op || op.trim().toLowerCase().equals("href")) {
            sbuf.append("href=\"");
            sbuf.append(url);
            sbuf.append(url.indexOf("?") != -1 ? "&" : "?");
            sbuf.append("pageNo=");
            sbuf.append(pageNo);
            sbuf.append(searchStr);
            sbuf.append("\"");
        } else {
            sbuf.append("href=\"javascript:;\" onclick=\"_tunePage(" + pageNo + ",'','" + url + "','" + target + "','"
                    + op + "','" + searchStr + "')\"");
        }
        return sbuf.toString();
    }

}
